package com.bh.shipment.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.utils.DateUtils;
import com.bh.shipment.domain.JcShipmentBackDetail;
import com.bh.shipment.mapper.JcShipmentBackDetailMapper;
import com.bh.shipment.service.IJcShipmentBackDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 运单回单明细Service业务层处理
 *
 * @author slx
 * @date 2023-04-22
 */
@Service
public class JcShipmentBackDetailServiceImpl extends ServiceImpl<JcShipmentBackDetailMapper, JcShipmentBackDetail> implements IJcShipmentBackDetailService {
    @Autowired
    private JcShipmentBackDetailMapper jcShipmentBackDetailMapper;

    /**
     * 查询运单回单明细
     *
     * @param id 运单回单明细主键
     * @return 运单回单明细
     */
    @Override
    public JcShipmentBackDetail selectJcShipmentBackDetailById(Long id) {
        return jcShipmentBackDetailMapper.selectById(id);
    }

    /**
     * 查询运单回单明细列表
     *
     * @param jcShipmentBackDetail 运单回单明细
     * @return 运单回单明细
     */
    @Override
    public List<JcShipmentBackDetail> selectJcShipmentBackDetailList(JcShipmentBackDetail jcShipmentBackDetail) {
        return jcShipmentBackDetailMapper.selectJcShipmentBackDetailList(jcShipmentBackDetail);
    }

    /**
     * 新增运单回单明细
     *
     * @param jcShipmentBackDetail 运单回单明细
     * @return 结果
     */
    @Override
    public int insertJcShipmentBackDetail(JcShipmentBackDetail jcShipmentBackDetail) {
        jcShipmentBackDetail.setCreateTime(DateUtils.getNowDate());
        return jcShipmentBackDetailMapper.insert(jcShipmentBackDetail);
    }

    /**
     * 修改运单回单明细
     *
     * @param jcShipmentBackDetail 运单回单明细
     * @return 结果
     */
    @Override
    public int updateJcShipmentBackDetail(JcShipmentBackDetail jcShipmentBackDetail) {
        return jcShipmentBackDetailMapper.updateById(jcShipmentBackDetail);
    }

    /**
     * 批量删除运单回单明细
     *
     * @param ids 需要删除的运单回单明细主键
     * @return 结果
     */
    @Override
    public int deleteJcShipmentBackDetailByIds(Long[] ids) {
        return jcShipmentBackDetailMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除运单回单明细信息
     *
     * @param id 运单回单明细主键
     * @return 结果
     */
    @Override
    public int deleteJcShipmentBackDetailById(Long id) {
        return jcShipmentBackDetailMapper.deleteById(id);
    }
}
